<h2><?= $this->translate("OrdersList") ?></h2>
<?php if (count($this->orders)>0) { ?>
    <table>
    	<tr>
    		<th>
    			<?= $this->translate("Id") ?>
    		</th>
    		<th>
    			<?= $this->translate("Time") ?>
    		</th>
    		<th>
    			<?= $this->translate("User") ?>
    		</th>
    		<th>
    			<?= $this->translate("Status") ?>
    		</th>
    	</tr>
    	
    	<?php $i=0; 
    		foreach ( $this->orders as $order ) { ?>
    		<tr>
    			<td>
    				<?= $order->id ?>
    			</td>
    			<?php
                    $dateCreated = explode('-',substr($order->timecreated,0,10));
                    $timeCreated = substr($order->timecreated,11,5);
                ?>
    			<td><?= $dateCreated[2] . '.' . $dateCreated[1] . '. ' . $dateCreated[0] . ' ' . $timeCreated ?></td>
    			<td>
    				<a href="<?= $this->url(array("controller"=>"users","action"=>"user-detail","id"=>$order->User->id)); ?>" title="<?= $order->User->username ?>"><?= $order->User->username ?></a>
    			</td>
    			<td>
    				<?= $this->status->translate($order->status); ?>
    			</td>
    			<td>
    				<a href="<?= $this->url(array("controller"=>"orders","action"=>"order-detail","id"=>$order->id)) ?>" title="<?= $this->translate("Detail") ?>"><?= $this->translate("Detail") ?></a>
    			</td>
    			<td>
    				<a href="<?= $this->url(array("controller"=>"orders","action"=>"remove-order","id"=>$order->id)) ?>" title="<?= $this->translate("Delete") ?>">
    				<?= $this->translate("Delete") ?></a>
    			</td>
    		</tr>
    	<?php $i++; 
    		} ?>
    </table>
    <?= $this->paginationControl($this->orders, 'Sliding', 'paginatorControl.phtml') ?>
<?php } else { ?>
    <?= $this->translate("No orders found") ?>
<?php } ?>